var indexData = require("../indexdata/indexdata.js");
var inviteHomedata = require('../inviteHomedata/inviteHomedata.js')
var num = 0;
//获取应用实例
const app = getApp()
Page({
  data: {
    currentTab: 0,//参数下标第几个分类
    navScrollLeft: 0,//参数下标第几个分类
    classifData: [
      {
        'index': 0,
        'id': 'classif0',
        'name': '单日购买',
        'scrollTop': '',
        'img': '../images/indexDetails/dancigou.png',
        'classifDetail': [
              {
                "flxh": "0",
                "spid": "1",
                "number": "1",
                "newText": "最高减100元",
                "newShow": false,
                "newShowRed": false,
                "productImg": "../images/index/1.png",
                "name": "特地欧顿至尊酸牛奶",
                "salesVolume": "6",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "16.00",
                'index': '0-0',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '3',//购买方式1图标2文字3加减
                'shouqing': false,//是否售罄
                'zhekouoff': true,//是否有折扣,true有
                'zhekou': '0.5折',
                'originalPrice': '￥6.00',
                "peiliao": '主要配料：特地牛奶，澳大利亚乳酪澳大利亚乳酪',  
              },
              {
                "flxh": "0",
                "spid": "2",
                "number": "2",
                "newText": "热销上市",
                "newShow": false,
                "newShowRed": true,
                "productImg": "../images/index/2.png",
                "name": "特地欧顿至尊酸牛奶特地欧顿至尊酸牛奶特地欧顿至尊酸牛奶特地欧顿至尊酸牛奶",
                "salesVolume": "9",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "156.00",
                'index': '0-1',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '1',//购买方式1图标2文字3加减
                'shouqing': false,//是否售罄
                'zhekouoff': true,//是否有折扣,true有
                'zhekou': '0.5折',
                'originalPrice': '￥6.00',
                "peiliao": '主要配料：特地牛奶，澳大利亚乳酪澳大利亚乳酪',  
              },
              {
                "flxh": "0",
                "spid": "1",
                "number": "1",
                "newText": "最高减100元",
                "newShow": false,
                "newShowRed": false,
                "productImg": "../images/index/1.png",
                "name": "特地欧顿至尊酸牛奶",
                "salesVolume": "6",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "16.00",
                'index': '0-2',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '3',//购买方式1图标2文字3加减
                'shouqing': true,//是否售罄
                'zhekouoff': true,//是否有折扣,true有
                'zhekou': '0.5折',
                'originalPrice': '￥6.00',
                "peiliao": '主要配料：特地牛奶，澳大利亚乳酪澳大利亚乳酪',  
              },
              {
                "flxh": "0",
                "spid": "1",
                "number": "1",
                "newText": "最高减100元",
                "newShow": false,
                "newShowRed": false,
                "productImg": "../images/index/1.png",
                "name": "特地欧顿至尊酸牛奶",
                "salesVolume": "6",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "16.00",
                'index': '0-3',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '3',//购买方式1图标2文字3加减
                'shouqing': false,//是否售罄
                'zhekouoff': true,//是否有折扣,true有
                'zhekou': '0.5折',
                'originalPrice': '￥6.00',
                "peiliao": '主要配料：特地牛奶，澳大利亚乳酪澳大利亚乳酪',  
              },
              {
                "flxh": "0",
                "spid": "1",
                "number": "1",
                "newText": "最高减100元",
                "newShow": false,
                "newShowRed": false,
                "productImg": "../images/index/1.png",
                "name": "特地欧顿至尊酸牛奶",
                "salesVolume": "6",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "16.00",
                'index': '0-4',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '3',//购买方式1图标2文字3加减
                'shouqing': false,//是否售罄
                'zhekouoff': true,//是否有折扣,true有
                'zhekou': '0.5折',
                'originalPrice': '￥6.00',
                "peiliao": '主要配料：特地牛奶，澳大利亚乳酪澳大利亚乳酪',  
              },
              {
                "flxh": "0",
                "spid": "1",
                "number": "1",
                "newText": "最高减100元",
                "newShow": false,
                "newShowRed": false,
                "productImg": "../images/index/1.png",
                "name": "特地欧顿至尊酸牛奶",
                "salesVolume": "6",
                "recommendText": "推荐产品",
                "recommendShow": false,
                "price": "16.00",
                'index': '0-5',//下标
                'countNum': '0',//输入框
                'minusBtn': true,//是否有减号输入框
                'waysofPurchasing': '3',//购买方式1图标2文字3加减
                'shouqing': false//是否售罄
              },
            ]
      },
      {
        'index': 1,
        'id': 'classif1',
        'name': '新鲜蔬菜',
        'scrollTop': '',
        'img': '../images/indexDetails/xinxianshucai.png',
        'classifDetail': [
          {
            "flxh": "0",
            "spid": "1",
            "number": "1",
            "newText": "最高减100元",
            "newShow": false,
            "newShowRed": false,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/shucai/1.png",
            "name": "小白菜",
            "salesVolume": "6",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "16.00",
            'index': '1-0',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '3',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄
          },
          {
            "flxh": "0",
            "spid": "2",
            "number": "2",
            "newText": "热销上市",
            "newShow": false,
            "newShowRed": true,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/shucai/2.png",
            "name": "菠菜",
            "salesVolume": "9",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "156.00",
            'index': '1-1',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '1',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄

          },
          {
            "flxh": "0",
            "spid": "3",
            "number": "3",
            "newText": "最高减100元",
            "newShow": false,
            "newShowRed": false,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/shucai/3.png",
            "name": "小白菜",
            "salesVolume": "6",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "16.00",
            'index': '1-2',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '3',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄
          },
          {
            "flxh": "0",
            "spid": "4",
            "number": "4",
            "newText": "热销上市",
            "newShow": false,
            "newShowRed": true,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/shucai/4.png",
            "name": "蔬菜礼盒",
            "salesVolume": "9",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "156.00",
            'index': '1-3',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '1',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄

          },
        ]
      },
      {
        'index': 2,
        'id': 'classif2',
        'name': '时令水果',
        'scrollTop': '',
        'img': '../images/indexDetails/shilingshuiguo.png',
        'classifDetail': [
          {
            "flxh": "0",
            "spid": "1",
            "number": "1",
            "newText": "最高减100元",
            "newShow": false,
            "newShowRed": false,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/shuiguo/1.png",
            "name": "橘子",
            "salesVolume": "6",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "16.00",
            'index': '2-0',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '3',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄
          },
          {
            "flxh": "0",
            "spid": "2",
            "number": "2",
            "newText": "热销上市",
            "newShow": false,
            "newShowRed": true,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/shuiguo/2.png",
            "name": "橙子",
            "salesVolume": "9",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "156.00",
            'index': '2-1',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '1',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄

          },
          {
            "flxh": "0",
            "spid": "3",
            "number": "3",
            "newText": "热销上市",
            "newShow": false,
            "newShowRed": true,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/shuiguo/3.png",
            "name": "火龙果",
            "salesVolume": "9",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "156.00",
            'index': '2-2',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '1',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄

          },
          {
            "flxh": "0",
            "spid": "4",
            "number": "4",
            "newText": "热销上市",
            "newShow": false,
            "newShowRed": true,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/shuiguo/4.png",
            "name": "芒果",
            "salesVolume": "9",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "156.00",
            'index': '2-3',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '1',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄

          },
          {
            "flxh": "0",
            "spid": "5",
            "number": "5",
            "newText": "热销上市",
            "newShow": false,
            "newShowRed": true,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/shuiguo/5.png",
            "name": "水蜜桃",
            "salesVolume": "9",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "156.00",
            'index': '2-4',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '3',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄

          },
        ]
      },
      {
        'index': 3,
        'id': 'classif3',
        'name': '水产冻品',
        'scrollTop': '',
        'img': '../images/indexDetails/shuichandongpin.png',
        'classifDetail': [
          {
            "flxh": "0",
            "spid": "1",
            "number": "1",
            "newText": "最高减100元",
            "newShow": false,
            "newShowRed": false,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/shuichan/1.png",
            "name": "生蚝",
            "salesVolume": "6",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "16.00",
            'index': '3-0',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '3',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄
          },
          {
            "flxh": "0",
            "spid": "2",
            "number": "2",
            "newText": "热销上市",
            "newShow": false,
            "newShowRed": true,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/shuichan/2.png",
            "name": "大闸蟹",
            "salesVolume": "9",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "156.00",
            'index': '3-1',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '1',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄

          },
          {
            "flxh": "0",
            "spid": "3",
            "number": "3",
            "newText": "热销上市",
            "newShow": false,
            "newShowRed": true,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/shuichan/3.png",
            "name": "黄花鱼",
            "salesVolume": "9",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "156.00",
            'index': '3-2',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '3',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄

          },
        ]
      },
      {
        'index': 4,
        'id': 'classif4',
        'name': '肉禽蛋品',
        'scrollTop': '',
        'img': '../images/indexDetails/rouqindanpin.png',
        'classifDetail': [
          {
            "flxh": "0",
            "spid": "1",
            "number": "1",
            "newText": "最高减100元",
            "newShow": false,
            "newShowRed": false,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/shuichan/1.png",
            "name": "鸡蛋",
            "salesVolume": "6",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "16.00",
            'index': '4-0',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '3',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄
          },
          {
            "flxh": "0",
            "spid": "2",
            "number": "2",
            "newText": "热销上市",
            "newShow": false,
            "newShowRed": true,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/shuichan/1.png",
            "name": "野生鸡蛋",
            "salesVolume": "9",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "156.00",
            'index': '4-1',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '3',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄

          },
        ]
      },
      {
        'index': 5,
        'id': 'classif5',
        'name': '粮油调味',
        'scrollTop': '',
        'img': '../images/indexDetails/liangyoutiaowen.png',
        'classifDetail': [
          {
            "flxh": "0",
            "spid": "1",
            "number": "1",
            "newText": "最高减100元",
            "newShow": false,
            "newShowRed": false,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/you/1.png",
            "name": "鲁花花生油",
            "salesVolume": "6",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "16.00",
            'index': '5-0',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '3',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄
          },
          {
            "flxh": "0",
            "spid": "2",
            "number": "2",
            "newText": "热销上市",
            "newShow": false,
            "newShowRed": true,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/you/2.png",
            "name": "龙大豆油",
            "salesVolume": "9",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "156.00",
            'index': '5-1',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '1',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄

          },
          {
            "flxh": "0",
            "spid": "3",
            "number": "3",
            "newText": "热销上市",
            "newShow": false,
            "newShowRed": true,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/you/3.png",
            "name": "金龙鱼玉米油",
            "salesVolume": "9",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "156.00",
            'index': '5-2',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '3',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄

          },
          {
            "flxh": "0",
            "spid": "4",
            "number": "4",
            "newText": "热销上市",
            "newShow": false,
            "newShowRed": true,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/you/4.png",
            "name": "调和油",
            "salesVolume": "9",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "156.00",
            'index': '5-3',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '3',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄

          },
        ]
      },
      {
        'index': 6,
        'id': 'classif6',
        'name': '休闲食品',
        'scrollTop': '',
        'img': '../images/indexDetails/xiuxianshipin.png',
        'classifDetail': [
          {
            "flxh": "0",
            "spid": "1",
            "number": "1",
            "newText": "最高减100元",
            "newShow": false,
            "newShowRed": false,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/dangaomianbao/1.png",
            "name": "提拉米苏",
            "salesVolume": "6",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "16.00",
            'index': '6-0',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '3',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄
          },
          {
            "flxh": "0",
            "spid": "2",
            "number": "2",
            "newText": "热销上市",
            "newShow": false,
            "newShowRed": true,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/dangaomianbao/2.png",
            "name": "面包",
            "salesVolume": "9",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "156.00",
            'index': '6-1',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '3',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄

          },
          {
            "flxh": "0",
            "spid": "3",
            "number": "3",
            "newText": "热销上市",
            "newShow": false,
            "newShowRed": true,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/dangaomianbao/3.png",
            "name": "蛋黄酥",
            "salesVolume": "9",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "156.00",
            'index': '6-2',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '3',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄

          },
          {
            "flxh": "0",
            "spid": "4",
            "number": "4",
            "newText": "热销上市",
            "newShow": false,
            "newShowRed": true,
            "productImg": app.globalData.url + "TsdXcx/img/pages/images/index/product/dangaomianbao/4.png",
            "name": "速速蛋挞",
            "salesVolume": "9",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "156.00",
            'index': '6-3',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '3',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄

          },
        ]
      },
      {
        'index': 7,
        'id': 'classif7',
        'name': '居家百货',
        'scrollTop': '',
        'img': '../images/indexDetails/jvjiabaihuo.png',
        'classifDetail': [
          {
            "flxh": "0",
            "spid": "1",
            "number": "1",
            "newText": "最高减100元",
            "newShow": false,
            "newShowRed": false,
            "productImg": "../images/index/1.png",
            "name": "居家百货",
            "salesVolume": "0",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "16.00",
            'index': '7-0',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '3',//购买方式1图标2文字3加减
            'shouqing': true//是否售罄
          },
          {
            "flxh": "0",
            "spid": "2",
            "number": "2",
            "newText": "热销上市",
            "newShow": false,
            "newShowRed": true,
            "productImg": "../images/index/2.png",
            "name": "居家百货",
            "salesVolume": "9",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "156.00",
            'index': '7-1',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '1',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄

          },
        ]
      },
      {
        'index': 8,
        'id': 'classif8',
        'name': '生活服务',
        'scrollTop': '',
        'img': '../images/indexDetails/shenghuofuwu.png',
        'classifDetail': [
          {
            "flxh": "0",
            "spid": "1",
            "number": "1",
            "newText": "最高减100元",
            "newShow": false,
            "newShowRed": false,
            "productImg": "../images/index/1.png",
            "name": "生活服务",
            "salesVolume": "6",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "16.00",
            'index': '8-0',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '3',//购买方式1图标2文字3加减
            'shouqing': true//是否售罄
          },
          {
            "flxh": "0",
            "spid": "2",
            "number": "2",
            "newText": "热销上市",
            "newShow": false,
            "newShowRed": true,
            "productImg": "../images/index/2.png",
            "name": "生活服务",
            "salesVolume": "9",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "156.00",
            'index': '8-1',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '1',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄

          },
        ]
      },
      {
        'index': 9,
        'id': 'classif9',
        'name': '其他',
        'scrollTop': '',
        'img': '../images/indexDetails/qita.png',
        'classifDetail': [
          {
            "flxh": "0",
            "spid": "1",
            "number": "1",
            "newText": "最高减100元",
            "newShow": false,
            "newShowRed": false,
            "productImg": "../images/index/1.png",
            "name": "其他",
            "salesVolume": "6",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "16.00",
            'index': '9-0',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '3',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄
          },
          {
            "flxh": "0",
            "spid": "2",
            "number": "2",
            "newText": "热销上市",
            "newShow": false,
            "newShowRed": true,
            "productImg": "../images/index/2.png",
            "name": "其他",
            "salesVolume": "9",
            "recommendText": "推荐产品",
            "recommendShow": false,
            "price": "156.00",
            'index': '9-1',//下标
            'countNum': '0',//输入框
            'minusBtn': true,//是否有减号输入框
            'waysofPurchasing': '1',//购买方式1图标2文字3加减
            'shouqing': false//是否售罄

          },
        ]
      },      
    ]

  },
  onLoad: function (options) {
    this.setData({
      //推荐消息， 订奶列表数据
      usedata: indexData.setdata,
    })

    wx.getSystemInfo({
      success: (res) => {
        this.setData({
          pixelRatio: res.pixelRatio,
          windowHeight: res.windowHeight,
          windowWidth: res.windowWidth
        })
      },
    })
    var cur = this.data.navScrollLeft;
    console.log(cur)
    //每个tab选项宽度占1/5
    var singleNavWidth = this.data.windowWidth / 5;
    //tab选项居中                            
    this.setData({
      navScrollLeft: (cur - 2) * singleNavWidth
    })
  },
  // 页面渲染 调用
  onShow: function () {
    var that = this;
  },
  goIndexDetails: function (event) {
    var newsid = event.currentTarget.dataset.newsid;
    wx.navigateTo({
      url: '../../../pages/details/details?newsid=' + newsid
      // 跳转到商品详情
    })
  },
  onShareAppMessage: function (res) {//20200313转发
    return {
      title: '转发',
      path: '/pages/index2/index2'
      // imageUrl: '../images/index/one.png'

    }
  },
  add: function (e) {
    // 加
    // classifData
    var count = this.data.classifData;
    var index = e.currentTarget.dataset.index;
    var countIndex = index.split("-");
    count[countIndex[0]].classifDetail[countIndex[1]].countNum++;
    count[countIndex[0]].classifDetail[countIndex[1]].minusBtn = false;
    this.setData({
      classifData: count
    });

  },
  minus: function (e) {
    // 减
    var count = this.data.classifData;
    var index = e.currentTarget.dataset.index;
    var countIndex = index.split("-");
    var numberCoun = count[countIndex[0]].classifDetail[countIndex[1]].countNum;
    if (numberCoun <= 1) {
      count[countIndex[0]].classifDetail[countIndex[1]].countNum = 0;
      count[countIndex[0]].classifDetail[countIndex[1]].minusBtn = true;
    } else {
      count[countIndex[0]].classifDetail[countIndex[1]].countNum--;
      count[countIndex[0]].classifDetail[countIndex[1]].minusBtn = false;
    }
    this.setData({
      classifData: count
    });
  },
  switchNav(event) {
    var cur = event.currentTarget.dataset.current;
    //每个tab选项宽度占1/5
    var singleNavWidth = this.data.windowWidth / 5;
    //tab选项居中                            
    this.setData({
      navScrollLeft: (cur - 2) * singleNavWidth
    })
    if (this.data.currentTab == cur) {
      return false;
    } else {
      this.setData({
        currentTab: cur
      })
    }
  },
  switchTab(event) {
    var cur = event.detail.current;
    var singleNavWidth = this.data.windowWidth / 5;
    this.setData({
      currentTab: cur,
      navScrollLeft: (cur - 2) * singleNavWidth
    });
  },
  goinviteHomeshoppingCart: function () {//跳转到购物车结算
    wx.redirectTo({
      url: '../inviteHomeshoppingCart/inviteHomeshoppingCart'
    })
  },
})